package com.antstorm.statistics.service.mqtt;

import lombok.Data;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * mqtt消息处理器
 */
@Component
@Data
public class MqttMsgHandlerImpl extends MqttMsgHandlerAbs {



    @PostConstruct
    @Override
    public void initTopic() {
        this.topic="test";
    }

    @Override
    public void handle(MqttMessage mqttMessage) {
        System.out.println("topic :" + topic +" ," +mqttMessage.getId());
        System.out.println("topic :" + topic + " , 接收到 mq消息 : " + new String(mqttMessage.getPayload()));
    }

}
